import { useState, useEffect } from 'react';
import { Space, Select, Tag, Pagination, Table, Button, Modal, Form, Input, message } from 'antd';
import { getStuScore } from '../../api/stu';
import { useAuth } from "../../context/AuthProvider";

const { Search } = Input;


const { CheckableTag } = Tag;




const Score = () => {
    const [todayclass, setClass] = useState([]);
    const [yearOptions, setYearOptions] = useState([]);
    const [scoreList, setSoreList] = useState([]);
    const { user, deleteUser } = useAuth();

    // const [selectedTags, setSelectedTags] = useState('');
    // const [news, setNews] = useState([]);
    // // const [total, setTotal] = useState(0);
    // // const [page, setPage] = useState(1);


    // console.log(weekday,"day")
    const columns = [
        {
            title: "课程名",
            dataIndex: "classname",
            key: "classname",
        },
        {
            title: "开课年份",
            dataIndex: "year",
            key: "year",
        },
        {
            title: "所属学院",
            dataIndex: "subject",
            key: "subject",
        },
        {
            title: "授课老师",
            dataIndex: "tname",
            key: "tname",
        },
        {
            title: "课堂得分",
            dataIndex: "dailyscore",
            key: "dailyscore",
        },
        {
            title: "考试得分",
            dataIndex: "testscore",
            key: "testscore",
        },

    ];
    useEffect(() => {
        var now = new Date();
        var weekday = now.getDay();

        getStuScore({id:user.loginid}).then((res) => {
            for(let i=0;i<res.length;i++){
                res.key=res.cid
            }
            setSoreList(res)
        })

    }, [])
    return (
        <div>
            
            <Table
                style={{ width: "100%" }}
                dataSource={scoreList}
                columns={columns}
            />
        </div>
    );
};
export default Score;